]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Special case terminal launching
authorDebarshi Ray <debarshir@gnome.org>
Thu, 9 Jan 2014 14:36:41 +0000 (15:36 +0100)
committerDebarshi Ray <debarshir@gnome.org>
Fri, 10 Jan 2014 11:08:14 +0000 (12:08 +0100)
One of the most frequent complaints about our launching behaviour is
how we handle terminals. Among all MDI applications, the terminal is
the one that is most likely to have lots of semi-independent windows
opened at the same time, and spawning new windows is much more common.
More so, if it does not support tabs.

Therefore, we special case terminal launchers to always create a new
window. It is an application that most non-technical users will not
use, so chances of them being confused by any special behaviour is
expected to be low.

https://bugzilla.gnome.org/show_bug.cgi?id=695010

js/ui/appDisplay.js

index cdd1e1aa6801aba075161532ca8fa89f0aa72749..1a04fdab864b9d17442a620003cc5f5898c42edd 100644 (file)
@@ -47,6 +47,10 @@ const INDICATORS_ANIMATION_MAX_TIME = 0.75;
 const PAGE_SWITCH_TRESHOLD = 0.2;
 const PAGE_SWITCH_TIME = 0.3;
 
+function _isTerminal(app) {
+    return app.get_app_info().get_categories().indexOf('TerminalEmulator') > -1;
+};
+
 // Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
 function _loadCategory(dir, view) {
     let iter = dir.iter();
@@ -913,7 +917,7 @@ const AppSearchProvider = new Lang.Class({
         let app = this._appSys.lookup_app(result);
         let event = Clutter.get_current_event();
         let modifiers = event ? event.get_state() : 0;
-        let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK;
+        let openNewWindow = (modifiers & Clutter.ModifierType.CONTROL_MASK) || _isTerminal(app);
 
         if (openNewWindow)
             app.open_new_window(-1);
@@ -1448,8 +1452,9 @@ const AppIcon = new Lang.Class({
     _onActivate: function (event) {
         let modifiers = event.get_state();
 
-        if (modifiers & Clutter.ModifierType.CONTROL_MASK
-            && this.app.state == Shell.AppState.RUNNING) {
+        if ((modifiers & Clutter.ModifierType.CONTROL_MASK
+             && this.app.state == Shell.AppState.RUNNING)
+            || _isTerminal(this.app)) {
             this.app.open_new_window(-1);
         } else {
             this.app.activate();